package com.itheima.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.pojo.Clazz;
import com.itheima.pojo.ClazzQueryPaeam;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ClazzMapper extends BaseMapper<Clazz> {

//    List<Clazz> page(ClazzQueryPaeam clazzQueryPaeam);

    @Delete("delete from clazz where id = #{id}")
    void delete(Integer id);

    @Select("select count(*) from student where clazz_id = #{id}")
    int count(Integer id);

    @Insert("insert into clazz(id, name, room, begin_date, end_date, master_id, subject, create_time, update_time) VALUES (null,#{name},#{room},#{beginDate},#{endDate},#{masterId},#{subject},#{createTime},#{updateTime})")
    void add(Clazz clazz);

    @Select("select * from clazz where id = #{id}")
    Clazz seleteId(Integer id);

    @Update("update clazz set name = #{name} , room = #{room} , begin_date = #{beginDate} , end_date = #{endDate} , master_id = #{masterId} , subject = #{subject} where id = #{id}")
    void update(Clazz clazz);

    @Select("select * from clazz")
    List<Clazz> findAll();


}
